#include "RstpNat.h"
#include "CommonOpt.h"


UInt32 SNatDataHeader::OutAsData( char * outBuf, UInt32 bufLen )
{
	if(!outBuf || bufLen < Size())
		return 0;
	
	PacketHandler Handler(outBuf,bufLen);
	Handler<<Version<<ChnID<<RequestID<<DataLen<<RequestPeerID<<AnwserPeerID;
	return Handler.Size();
}

Bool SNatDataHeader::Parse( const char * pBuff, UInt32 vBuffLen )
{
	if(!pBuff || vBuffLen < Size())
		return FALSE;
	
	PacketHandler Handler(pBuff,vBuffLen);
	Handler>>Version>>ChnID>>RequestID>>DataLen>>RequestPeerID>>AnwserPeerID;
	if(Handler.Size() == Size())
		return TRUE;
	return FALSE;
}

